<template>
	<view class="list" v-for="(item,index) in allData" :key="index">
		<view class="one">
			<image class="image" :src="item.gender == '1' ? '../../../static/icon/男.png' : '../../../static/icon/女.png'" alt=""></image>
		</view>
		<view class="two">
			<view class="top_box">
				<text class="name">{{item.name}} / </text>
				<text class="sex">{{item.ageValue}}岁</text>
				<text class="phone">{{item.tel}}</text>
			</view>
			<view class="bottom_box">
				<text class="time">{{item.time}}</text>
				<view class="btn_box">
					<view :class="item.visitStatus == '已接诊' && item.settlementState == 1 ?'button3':item.visitStatus == '已接诊' && item.settlementState == 2 ?'button2':'button1'" @click="btnClick(item)">{{ item.visitStatus == "已接诊" && item.settlementState == 1 ?'召回处方':item.visitStatus == "已接诊" && item.settlementState == 2 ?'复诊':'接诊' }}</view>
					<view class="shanchu">
						<image v-if="tabFlag == 1 || tabFlag == 0" mode="" src="../../../static/icon/shanchu.png"
							@click="delectClick(item)"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			allData: {
				type: Array,
				default: () => [{
					name: "张三",
					age: "42",
					mobile: "15100000000",
					createDate: "2023-11-11 08:00:00",
					gender: "1",
					btnFlag: "1", //1是接诊，2是复诊，3是召回处方
				}]
			},
			tabFlag: Number
		},
		data() {
			return {
				manIcon: "../../../static/icon/男.png",
				womanIcon: "../../../static/icon/女.png"
			}
		},
		methods: {
			btnClick(item) {
				this.$emit("btnClick", item)
			},
			delectClick(item) {
				this.$emit("deleteClick", {
					item,
					flag: this.tabFlag
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 750rpx;
		height: 130rpx;
		margin-bottom: 10rpx;
		display: flex;
		align-items: center;
		padding: 30rpx 0;
		background-color: #fff;

		.one {
			width: 130rpx;
			height: 130rpx;
			box-sizing: border-box;
			padding: 20rpx;

			.image {
				width: 100%;
				height: 100%;
			}
		}

		.two {
			width: calc(750rpx - 130rpx);
			height: 130rpx;

			.top_box,
			.bottom_box {
				width: 100%;
				height: 65rpx;
				display: flex;
				align-items: center;
				font-size: 28rpx;
				padding: 10rpx;
				box-sizing: border-box;
			}

			.top_box {
				.name {
					font-weight: 600;
				}

				.sex {
					padding-left: 10rpx;
					color: #333;
				}

				.phone {
					padding-left: 10rpx;
					color: #333;
				}
			}

			.bottom_box {
				justify-content: space-between;

				.time {
					color: #666;
				}

				.btn_box {
					display: flex;
					align-items: center;

					.shanchu {
						width: 40rpx;
						height: 40rpx;

						image {
							width: 100%;
							height: 100%;
						}
					}
				}
			}
		}
	}

	.button1,
	.button2,
	.button3 {
		// width: 110rpx;
		padding: 0 40rpx;
		height: 56rpx;
		border-radius: 4rpx;

		color: #fff;
		text-align: center;
		line-height: 56rpx;
		font-size: 26rpx;
		margin-right: 26rpx;
	}

	.button1 {
		background-color: #e6a23c;
	}

	.button2 {
		background-color: #07c160;
	}

	.button3 {
		background-color: #409eff;
	}

	.button1:active {
		background-color: rgba(230, 162, 60, 0.5);
	}

	.button2:active {
		background-color: rgba(7, 193, 96, 0.5);
	}

	.button3:active {
		background-color: rgba(64, 158, 255, 0.5);
	}
</style>